package com.uenpay.im.invokeitems.contacts;

import com.qiyunxin.android.http.net.HttpInvokeItem;
import com.uenpay.im.configuration.APIConfiguration;

import org.json.JSONException;
import org.json.JSONObject;

/**
 *
 * @author SL
 * @copyRight http://www.qiyunxin.com
 */
public class DeleteFriendsInvokItem extends HttpInvokeItem {
	public class DeleteFriendsInvokItemResult {
		public int status;
		public String msg;
	}

	public DeleteFriendsInvokItemResult getOutput() {
		return (DeleteFriendsInvokItemResult) GetResultObject();
	}

	public DeleteFriendsInvokItem(String to_cust_id) {
		String url = APIConfiguration.getBaseUrl()
				+ "/Friend/Friend/deleteFriend?custid=" + to_cust_id + "&"
				+ APIConfiguration.getCustIdAndToken();
		SetUrl(url);
	}

	@Override
	protected Object DeserializeResult(String responseBody) throws Exception {
		DeleteFriendsInvokItemResult result = new DeleteFriendsInvokItemResult();
		try {
			JSONObject json = new JSONObject(responseBody);
			result.status = json.optInt("status");
			result.msg = json.optString("msg");

		} catch (JSONException e) {
			e.printStackTrace();
			return result;
		}
		return result;
	}

}
